<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // get 请求
        fetch('http://localhost:3000/books?id=3', {
            method: 'get'
        }).then((data) => {
            return data.text()
        }).then((data) => {
            console.log(data)
        })

        fetch('http://localhost:3000/books/2', {
                method: 'get'
            }).then((data) => {
                return data.text()
            }).then((data) => {
                console.log(data)
            })
            // delete 请求

        fetch('http://localhost:3000/books/3', {
            method: 'delete'
        }).then((data) => {
            return data.text()
        }).then((data) => {
            console.log(data)
        })
    </script>
</body>

</html>